import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    // redirect: 'home/index'
    component: () => import('../views/AboutView.vue')
  },

  {
    path: '/home',
    name: 'home',
    component: HomeView,
    children: [{
      path: 'index',
      component: () => import('../views/index/index.vue'),
    },
    {
      path: 'inspiration',
      name: 'inspiration',
      component: () => import('../views/index/inspiration.vue'),
    },
    {
      path: 'detail',
      name: 'detail',
      component: () => import('../views/index/detail.vue'),
    },
    {
      path: 'carts',
      name: 'carts',
      component: () => import('../views/index/carts.vue'),
    },
    {
      path: 'sou',
      component: () => import('../views/index/search/Search.vue'),
      children: [
        {
          path: 'searchhistory',
          component: () => import('../views/index/search/searchHistory.vue'),
        },
        {
          path: 'soulist',
          component: () => import('../views/index/search/searchList.vue'),
        },
      ]
    },
    {
      path: 'search',
      redirect: 'search/foryou',
      component: () => import('../views/search/search.vue'),
      children: [
        {
          //为你推荐
          path: 'foryou',
          component: () => import('../views/search/searchForyou.vue')
        },
        {
          //最佳设计榜
          path: 'design',
          component: () => import('../views/search/design.vue')
        },
        {
          //口碑设计师
          path: 'designer',
          component: () => import('../views/search/designer.vue')
        },
        {
          //特色样板间
          path: 'room',
          component: () => import('../views/search/room.vue')
        },
      ],
    },
    {
      path: 'decoration',
      redirect: 'decoration/index',
      component: () => import('../views/decoration/decoration.vue'),
      children: [
        {
          path: 'index',
          component: () => import('../views/decoration/about/Index.vue'),
        },
        {
          path: 'wardrobe',
          component: () => import('../views/decoration/about/Wardrobe.vue')
        }, {
          path: 'kitchen',
          component: () => import('../views/decoration/about/Kitchen.vue')
        }, {
          path: 'bookshelf',
          component: () => import('../views/decoration/about/Bookshelf.vue')
        }, {
          path: 'shoe',
          component: () => import('../views/decoration/about/Shoe.vue')
        }, {
          path: 'tv-stand',
          component: () => import('../views/decoration/about/TVstand.vue')
        }
      ]
    },
    {
      path: 'shop',
      component: () => import('../views/shop/shop.vue'),
    },
    {
      path: 'me',
      redirect: 'me/index',
      component: () => import('../views/me/me.vue'),
      children: [
        {
          path: 'index',
          component: () => import('../views/me/me_index.vue')
        },
      ]
    },
    ]
  },
  // 配送地址
  {
    path: '/address',
    component: () => import('../views/shop/address.vue')
  },
  //发现页面路由
  {
    //发现页面-为你推荐
    path: '/foryou',
    component: () => import('../views/search/searchForyou.vue')
  },
  {
    //发现页面-最佳设计榜
    path: '/design',
    component: () => import('../views/search/design.vue')
  },
  {
    //发现页面-口碑设计师
    path: '/designer',
    component: () => import('../views/search/designer.vue')
  },
  {
    //发现页面-特色样板间
    path: '/room',
    component: () => import('../views/search/room.vue')
  },
  {
    // 宝贝评价
    path: '/evaluate',
    component: () => import('../views/shop/evaluate.vue')
  },
  {
    // 商品详情
    path: '/product',
    name: 'product',
    component: () => import('../views/shop/product.vue')
  },

  {
    //我的收藏
    path: '/sc',
    name: "me_add",
    component: () => import('../views/me/me_add.vue')

  },
  {
    //我的订单
    path: '/ac',
    name: "me_list",
    component: () => import('../views/me/me_list.vue')

  },
  {
    //推送历史
    path: '/bc',
    name: "me_history",
    component: () => import('../views/me/me_history.vue')

  },
  {
    //常见问题
    path: '/cc',
    name: "me_issue",
    component: () => import('../views/me/me_issue.vue')

  },
  {
    // 设置
    path: '/dc',
    name: "set",
    component: () => import('../views/me/set.vue')

  },
  {
    // 软件介绍
    path: '/ec',
    name: "introduce",
    component: () => import('../views/me/introduce.vue')


  },
  {
    // 购物车
    path: '/fc',
    name: "shoppingcart",
    component: () => import('../views/me/shoppingcart.vue')


  },
  {
    // 登录
    path: '/login',
    name: "login",
    component: () => import('../views/login/login.vue')


  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
